<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title> {$setting.webname}- 报名记录搜索</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="/public/static/favicon.ico"> <link href="/public/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/public/static/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/public/static/admin/css/animate.css" rel="stylesheet">
    <link href="/public/static/admin/css/plugins/footable/footable.core.css" rel="stylesheet">
    <link href="/public/static/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="/public/static/admin/css/plugins/switchery/switchery.css" rel="stylesheet">


</head>

<body class="gray-bg">
    <div class="row wrapper border-bottom white-bg page-heading">
        <div class="col-sm-4">
            <h2>报名记录搜索</h2>
            <ol class="breadcrumb">
                <li>
                    <a href="{:url('Admins/admin')}">主页</a>
                </li>
                <li>
                    <strong>报名搜索列表</strong>
                </li>
            </ol>
        </div>
        <div class="col-sm-8" style="text-align: right;line-height: 15px;margin-top:25px;">

        </div>
    </div>
    <div class="wrapper wrapper-content animated fadeIn">
        <div class="row">
            <div class="col-sm-12">
                <form action="" id="form1">
                <div class="row" style="margin-bottom: 20px">
                        <div class="col-sm-1">
                            <input type="text" placeholder="姓名" name="name" id="name" class="input form-control">
                        </div>
                        <div class="col-sm-1">
                            <select name="sex" id="sex" class="form-control">
                                <option value="" readonly selected>性别</option>
                                <option value="1">男</option>
                                <option value="0">女</option>
                            </select>
                        </div>
                        <div class="col-sm-1">
                            <select name="nation" id="nation"  class="form-control">
                                <option value="" readonly selected>民族</option>
                                {foreach $nation as $v}
                                <option value="{$v.name}">{$v.name}</option>
                                {/foreach}
                            </select>
                        </div>
                        <div class="col-sm-1">
                            <select name="grade" id="grade" class="form-control">
                                <option value="" readonly selected>年级</option>
                            </select>
                        </div>
                        <div class="col-sm-2">
                            <input type="text" placeholder="学生号码" name="phone" id="phone" class="input form-control">
                        </div>
                        <div class="col-sm-3">
                            <input type="text" placeholder="父母电话" name="parenttel" id="parenttel" class="input form-control">
                        </div>

                        <div class="col-sm-3">
                            <input type="text" placeholder="身份证号" name="idcards" id="idcards" class="input form-control">
                        </div>
                </div>
                <div class="row" style="margin-bottom: 20px">

                        <div class="col-sm-3">
                            <input type="text" placeholder="毕业学校所在地址" id="schooladdress" name="schooladdress" class="input form-control">
                        </div>
                        <div class="col-sm-3">
                            <input type="text" name="schoolname" placeholder="学校名称" id="schoolname" class="input form-control">
                        </div>
                        <div class="col-sm-3">
                            <input type="text" placeholder="通讯地址" name="address" id="address" class="input form-control">
                        </div>
                        <div class="col-sm-3">
                            <select name="major" id="major33"  class="form-control">
                                <option value="" readonly selected>专业1</option>
                                {foreach $course as $v}
                                <option value="{$v.course_id}">{$v.ecc}</option>
                                {/foreach}
                            </select>
                        </div>
                </div>
                <div class="row" style="margin-bottom: 20px">
                        <div class="col-sm-2">
                            <select name="status" id="status" class="form-control">
                                <option value="" readonly selected>状态</option>
                                {foreach $status as $v}
                                <option value="{$v.id}">{$v.type_name}</option>
                                {/foreach}
                            </select>
                        </div>
                        <div class="col-sm-1">
                            <select name="paytype" id="paytype1" class="form-control">
                                <option value="" readonly selected>支付类型</option>
                                <option value="微信">微信</option>
                            </select>
                        </div>
                        <div class="col-sm-3">
                            <input type="text" placeholder="支付账号名称" name="payid" id="payid1" class="input form-control">
                        </div>
                        <div class="col-sm-2">

                            <select name="teacher" id="teacher1" class="form-control">
                                <option value="" readonly selected>负责老师</option>
                                {foreach $teacher as $val}
                                <option value="{$val.name}">{$val.name}</option>
                                {/foreach}
                            </select>
                        </div>
                        <div class="col-sm-2">
                            <input type="text" placeholder="通知书编号" name="advice_note" id="advice_note" class="input form-control">
                        </div>
                        <div class="col-sm-2">
                            <button type="button" class="btn btn btn-info" style="width: 100%" id="search"> <i class="fa fa-search"></i> 综合搜索</button>
                        </div>

                </div>
                </form>
                <div class="tabs-container">
                    <div class="tab-content">

                        <!--新闻列表开始-->
                            <div class="table-responsive">
                                <table class="footable table table-stripped toggle-arrow-tiny table-hover" data-page-size="15">
                                    <thead>
                                    <tr>
                                        <th data-toggle="true">编号</th>
                                        <th>年级</th>
                                        <th>姓名</th>
                                        <th>电话</th>
                                        <th>父母电话</th>
                                        <th>报考类别</th>
                                        <th>专业大类</th>
                                        <th>专业1</th>
                                        <th>专业2</th>
                                        <th>服从调剂</th>
                                        <th>负责老师</th>
                                        <th>报名时间</th>
                                        <th>状态</th>
                                        <th>通知书编号</th>
                                        <th>操作</th>
                                        <th data-hide="all">性别</th>
                                        <th data-hide="all">民族</th>
                                        <th data-hide="all">qq/微信</th>
                                        <th data-hide="all">毕业学校所在地</th>
                                        <th data-hide="all">学校名称</th>
                                        <th data-hide="all">中考（模拟）成绩</th>
                                        <th data-hide="all">身份证号</th>
                                        <th data-hide="all">通讯地址</th>
                                        <th data-hide="all">报名修改时间</th>
                                        <th data-hide="all">支付类型</th>
                                        <th data-hide="all">支付账号</th>
                                        <th data-hide="all">支付时间</th>
                                        <th data-hide="all">学生备注</th>
                                        <th data-hide="all">老师备注</th>
                                        <th data-hide="all">拒绝理由</th>
                                    </tr>
                                    </thead>
                                    <tbody id="datas">

                                    </tbody>
                                </table>
                            </div>
                        <!-- 列表结束 -->
                        <tfoot>
                        <tr>
                            <td colspan="9">
                                <ul class="pagination pull-left"></ul>
                            </td>
                        </tr>
                        </tfoot>
                    </div>
                </div>
            </div>
        </div>
       
    </div>
    <!--弹出层-->
    <style>
        .layer_notice{
            width: 90%;
            margin:10px auto;
            line-height: 30px;
            display: none;
        }
        .layer_notice select{
            height: 35px;
        }
    </style>
    <!--录取通过-->
    <div class="layer_notice" id="check">
        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">姓名：</label>
            <div class="col-sm-7 col-sm-7" id="usernames"> </div>
        </div>
        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">身份证号：</label>
            <div class="col-sm-7 col-sm-7" id="idcard"> </div>
        </div>
        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">报考类型：</label>
            <div class="col-sm-7 col-sm-7" id="bktype"> </div>
        </div>
        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">专业1：</label>
            <div class="col-sm-7 col-sm-7" id="major"> </div>
        </div>
        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">专业2：</label>
            <div class="col-sm-7 col-sm-7" id="major22"> </div>
        </div>
        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">服从调剂：</label>
            <div class="col-sm-7 col-sm-7" id="isadjust"> </div>
        </div>
        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">支付类型：</label>
            <div class="col-sm-7 col-sm-7" id="paytype"> </div>
        </div>
        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">支付账号：</label>
            <div class="col-sm-7 col-sm-7" id="payid"> </div>
        </div>
        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">支付时间：</label>
            <div class="col-sm-7 col-sm-7" id="paytime"> </div>
        </div>
        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">报名时间：</label>
            <div class="col-sm-7 col-sm-7" id="times"> </div>
        </div>
        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">负责老师：</label>
            <div class="col-sm-7 col-sm-7" id="teacher_m"></div>
        </div>
        <div class="row">
            <div class="col-sm-12" style="text-align: right;">
                <button class="btn closes">取消</button>
                <button class="btn btn-info" id="classAddStudent">通过</button>
            </div>
        </div>
    </div>
    <!--信息审核-->
    <div class="layer_notice" id="pass">
        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">姓名：</label>
            <div class="col-sm-7 col-sm-7" id="usernames2"> </div>
        </div>
        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">身份证号：</label>
            <div class="col-sm-7 col-sm-7" id="idcard2"> </div>
        </div>
        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">报考类型：</label>
            <div class="col-sm-7 col-sm-7" id="bktype2"> </div>
        </div>
        <div class="row" id="major100">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">专业1：</label>
            <div class="col-sm-7 col-sm-7" id="major2"> </div>
        </div>
        <div class="row" id="major101">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">专业2：</label>
            <div class="col-sm-7 col-sm-7" id="major222"> </div>
        </div>
        <div class="row" id="isadjust100">
        <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">服从调剂：</label>
            <div class="col-sm-7 col-sm-7" id="isadjust2"> </div>
        </div>

        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">报名时间：</label>
            <div class="col-sm-7 col-sm-7" id="times2"> </div>
        </div>
        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">负责老师：</label>
            <div class="col-sm-7 col-sm-7">
                <select class="form-control" name="teacher" id="teacher" style="height: 30px;padding:3px 9px;">
                    <option value="">=选择负责老师=</option>
                    {foreach $teacher as $val}
                    <option value="{$val.name}" data-id="{$val.id}">{$val.name}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="row">
            <label class="col-sm-5 col-xs-5" style="text-align: right;font-size:16px;">备注：</label>
            <div class="col-sm-7 col-sm-7">
                <input type="text" id="teacher_comment" class="form-control" name="teacher_comment">
            </div>
        </div>

        <div class="row">
            <div class="col-sm-12" style="text-align: right;">
                <button class="btn closes" >取消</button>
                <button class="btn btn-info" id="classAddStudent2">通过</button>
            </div>
        </div>
    </div>
    <!--通知书-->
    <div class="layer_notice" id="print_advice_node" style="width: 300px;height:440px">

    </div>
    <!--弹出层-->
    <!-- 全局js -->
    <script src="/public/static/admin/js/jquery.min.js?v=2.1.4"></script>

    <script src="/public/static/admin/js/bootstrap.min.js?v=3.3.6"></script>

    <!-- iCheck -->
    <script src="/public/static/admin/js/plugins/iCheck/icheck.min.js"></script>
    <!-- Switchery -->
    <script src="/public/static/admin/js/plugins/switchery/switchery.js"></script>

    <!-- 自定义js -->
    <script src="/public/static/admin/js/content.js?v=1.0.0"></script>
    <script src="/public/static/admin/layui/layui.js"></script>
    <script src="/public/static/admin/js/plugins/footable/footable.all.min.js"></script>
    <script src="/public/static/admin/js/jquery.jqprint-0.3.js"></script>
    <script>
        $(document).ready(function() {
            $('.footable').footable();
            $(".tabs").attr("class","tab-pane");
        });
        var dateyear = new Date().getFullYear();
        for(i=dateyear;i>=dateyear-10;i--) {
            $("#grade").append($("<option value="+i+">"+i+"</option>"));
        }
        layui.use('layer', function(){ //独立版的layer无需执行这一句
            var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
            //删除
            $("#datas").on("click",".del",function(){
                var s = $(this);
                top.layer.open({
                    type: 1
                    ,title: false //不显示标题栏
                    ,closeBtn: false
                    ,area: '300px;'
                    ,shade: 0.8
                    ,id: 'LAY_layuipro' //设定一个id，防止重复弹出
                    ,btn: ['确定', '取消']
                    ,btnAlign: 'c'
                    ,moveType: 1 //拖拽模式，0或者1
                    ,content: '<div style="padding: 20px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">请您备注一下移入回收站的原因:<br/><input type="text" name="del_comment" id="del_comment" style="width: 100%;outline: none;color:#000"/></div>'
                    ,yes: function(){
                        $del_comment =  $("#del_comment").val();
                        if($del_comment == ""){
                            top.layer.msg("请输入移入回收站的原因",{
                                time:2000,
                                shade:0.5
                            },function(){
                                $("#del_comment").focus();
                            })
                        }else{
                            $.post("{:url('Search/deletes')}",{id:s.attr('data-id'),typeid:s.attr('data-type'),del_comment:$("#del_comment").val()},function(data){
                                top.layer.closeAll();
                                top.layer.msg(data.msg,{time:2000,shade:0.5},function(){
                                    if(data.url){
                                        window.location.href = data.url;
                                    }
                                });
                            });
                        }
                    }
                });
            });
            //查询内容
            $("#search").on("click",function(){
                var load = layer.load(1,{time:1000*60*10,shade:0.5}); //搜索等待特效
                 var form = $("#form1").serializeArray()
                 var data = {}
                 form.forEach((_this)=>{
                     data[_this.name] = _this.value;
                })
                console.log(data);
                $.post("{:url('Search/toSearch')}", data ,function(data){
                    if(data.code){
                        $("#datas").html(data.msg).trigger('footable_redraw');
                        layer.close(load); //关闭特效窗口
                    }else{
                        top.layer.closeAll();
                        top.layer.msg(data.msg,{time:2000,shade:0.5},function(){
                            if(data.url){
                                window.location.href = data.url;
                            }
                        });
                    }
                });
            });
            $("#datas").on("click",".rotate",function(){
                var s = $(this);
                console.log(s);
                top.layer.msg('你确定要将\"'+s.data('username')+'\"的报名修改为待支付吗？', {
                    time: 20000, //20s后自动关闭
                    shade: 0.8,
                    btn: ['确定', '取消'],
                    btn1:function(){
                        $.post("{:url('Search/dzf')}",{id:s.data('id'),typeid:s.data('typeid')},function(data){
                            top.layer.closeAll();
                            top.layer.msg(data.msg,{time:2000,shade:0.5},function(){
                                $("#search").click();
                            });
                        });
                    }
                });
            });
            //拒绝
            $("#datas").on("click",".times",function(){
                var s = $(this);
                layer.prompt({title: '请输入拒绝理由', formType: 2}, function(text){
                       if(text != "") {
                           $.post("{:url('Search/times')}", {
                               reason: text,
                               id: s.attr('data-id'),
                               typeid: s.attr('data-typeid')
                           }, function (data) {
                               top.layer.closeAll();
                               top.layer.msg(data.msg, {time: 2000,shade:0.5}, function () {
                                     $("#search").click();
                               });
                           });
                       }
                });
            });
            $("#search").click();
            //确认支付
            $("#datas").on("click",".check",function(){
                var s = $(this);
                $("#usernames").text(s.data("username"));
                $("#idcard").text(s.data("idcard"));
                $("#bktype").text(s.data("bktype"));
                $("#major").text(s.data("major"));
                $("#major22").text(s.data("major2"));
                $("#isadjust").text(s.data("isadjust"));
                $("#teacher_m").text(s.data("teacher"));
                $("#classAddStudent").attr("data-id",s.data("id"));
                if(s.data("paytype") == "微信") {
                    $("#paytype").html("<span style='color:green'>微信</span>");
                    $("#payid").html("<span style='color:green'>"+s.data("payid")+"</span>");
                }else if(s.data("paytype") == "支付宝"){
                    $("#paytype").html("<span style='color:blue'>支付宝</span>");
                    $("#payid").html("<span style='color:blue'>"+s.data("payid")+"</span>");

                }
                $("#paytime").text(s.data("paytime"));
                $("#times").text(s.data("times"));
               //页面层
                layer.open({
                    type: 1,
                    skin: false, //加上边框
                    title: "确认支付信息-确定录取",
                    area: ['300px', 'AUTO'], //宽高
                    content: $("#check")  //调到新增页面
                });
            });

            //录取报名通过
            $("#datas").on("click",".pass",function(){
                var s = $(this);
                $("#usernames2").text(s.data("username"));
                $("#idcard2").text(s.data("idcard"));
                $("#bktype2").text(s.data("bktype"));
                if(s.data("bktype") == "职普融通班（普高部）"){
                    $("#major100").hide()
                    $("#major101").hide()
                    $("#isadjust100").hide()
                }else{
                    $("#major100").show()
                    $("#major101").show()
                    $("#isadjust100").show()
                }
                $("#major2").text(s.data("major"));
                $("#major222").text(s.data("major2"));
                $("#isadjust2").text(s.data("isadjust"));
                $("#classAddStudent2").attr("data-id",s.data("id"));
                $("#times2").text(s.data("times"));
                var teacher = s.data('teacher');
                if(teacher!=="") {
                    $("#teacher option[value="+teacher+"]").prop("selected",true);
                    // $("#teacher").prop("disabled",true);
                }else{
                    $("#teacher option:eq(0)").prop("selected",true);
                }
                //页面层
                layer.open({
                    type: 1,
                    skin: false, //加上边框
                    title: "录取通知信息",
                    area: ['300px', 'auto'], //宽高
                    content: $("#pass"),  //调到新增页面
                });
            });
            //报名信息审核通过按钮
            $("#classAddStudent2").click(function(){
                var s = $(this);
                if($("#teacher").val() == ""){
                    top.layer.msg("请输入负责老师姓名", {time: 2000,shade:0.5}, function () {
                       $("#teacher").focus();
                    });
                    return false;
                }

                $.post("{:url('Search/classAddStudent2')}", {
                    id: s.data('id'),
                    teacher : $("#teacher").val()
                }, function (data) {
                    layer.closeAll();
                    top.layer.msg(data.msg, {time: 2000,shade:0.5}, function () {
                        if (data.url) {
                            $("#search").click();
                        }
                    });
                })
            });
            //关闭弹出层
            $(".closes").click(function(){
                layer.closeAll();
            });
            $("#classAddStudent").click(function(){
                var s = $(this);
                $.post("{:url('Search/classAddStudent')}", {
                    id: s.attr('data-id'),
                }, function (data) {
                    layer.closeAll();
                    top.layer.msg(data.msg, {time: 2000,shade:0.5}, function () {
                        if (data.url) {
                            $("#search").click();
                        }
                    });
                })
            });
            //打印通知书
            $("#datas").on("click",'.print',function(){
                var _this = $(this)
                var _time = Date.parse( new Date() ).toString();//获取到毫秒的时间戳，精确到毫秒
                _time = _time.substr(0,10);//精确到秒

                //请求数据，生成图片
                $("#print_advice_node").empty();
                $("#print_advice_node").append($("<img src='"+"{:url('Search/create_advice')}"+"?id="+_this.data('id')+"&time="+_time+"' width='100%'/>"));
                //页面层
                layer.open({
                    type: 1,
                    skin: false, //加上边框
                    title: "通知书",
                    area: ['300px', 'AUTO'], //宽高
                    content: $("#print_advice_node"),  //
                    btn:['打印',"取消"],
                    yes:function(){
                        $("#print_advice_node").jqprint();
                        layer.load(1, {
                            shade: 0.5,
                            time: 3*1000,
                        });
                        setTimeout(()=> {
                            var advice_print_msg = layer.msg('打印成功后请在此处已确认【' + _this.data("name") + '】同学的通知书是否已经打印成功，如果成功请点击【成功】按钮用于保存通知书编号，如果失败需要重新打印点击【重新打印】关闭该提醒并重新点击上层弹窗的【打印】按钮再次打印。', {
                                time: 200000, //20s后自动关闭
                                shade: 0.8,
                                btn: ['成功', '重新打印'],
                                btn1: function () {
                                    $.post("{:url('Search/advice_node')}", {
                                        id: _this.data('applyid'),
                                        advice_note: _time,
                                        pid: _this.data('pid')
                                    }, function (data) {
                                        layer.closeAll();
                                        layer.msg(data.msg, {time: 2000, shade: 0.5}, function () {
                                            if (data.url) {
                                                $("#search").click();
                                            }
                                        });
                                    });
                                },
                                btn2: function () {
                                   layer.close(advice_print_msg)
                                }
                            });
                        },3000);

                    }
                });
            });

        });
    </script>

    
    

</body>

</html>
